package com.cmpan.networkdisk.utility;


/**
 * ClassName:test
 * Package:com.cmpan.networkdisk.utility
 * Description:
 *
 * @Date:2020/7/13 19:00
 * @com.chuangmei
 */
public class test {

    public static void main(String[] args) {

        //array
        int[] array = {10,5,84,6,95,45,2};

        for(int i = array.length - 1; i > 0; --i){
            for (int j = 0; j < i; ++j){
                if (array[j] < array[j+1]){
                    int temp = 0;
                    temp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = temp;
                }
            }
        }

        foreach(array);

    }

    //遍历数组方法
    public static void foreach(int[] array){
        for (int i = 0; i < array.length; ++i){
            System.out.println(array[i]);
        }

    }

}
